package com.boot.service.impl;

import com.boot.dao.UserDao;
import com.boot.entity.User;
import com.boot.service.UserService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

import java.util.List;

@Service
public class UserServiceImpl implements UserService {

    @Autowired
    private UserDao userDao;

    @Override
    public User login(String username) {
        return userDao.getUser(username);
    }

    @Override
    public List<User> findAllUser() {
        return userDao.getUsers();
    }

    @Override
    public void addUser(User user) {
        userDao.addUser(user);
    }

    @Override
    public boolean checkUser(String username) {
        if(userDao.getUser(username) != null){
            return true;
        }
        return false;
    }
}
